<?php
include "./common.php";
ini_set('max_execution_time',0);
global $RSS_SITE_DIR;
$RSS_SITE_DIR=dirname(dirname(__FILE__));

header("Content-type: text/html;charset=utf8");

$url='http://rssagro.ru/agro/_rss_habra.xml';
$url='http://rssagro.ru/agro/_atom_google.xml';
$url='http://reynholm.livejournal.com/data/atom';
$url='http://rssagro.ru/agro/_atom_lj.xml';
$url=urldecode($url);

//print $stream->url."<br/>\n<br/>\n";
$parser=new RssParserImport();
if ( !$stream=$parser->Load( $url ) )
{
	trigger_error('Cant load '.$url);
}
$parser=new RssParserCacheImage();
$parser->Save( &$stream, "/files/%host/%Y-%m-%d");


//$parser=new RssParserMysql();
//$parser->Save( &$stream );


if (0)
{
	print $stream->title."\n";
	print sizeof( $stream->data )."\n";
	foreach ((array)$stream->data as $k=>$v)
	{
		print "\t".$v->title."\n";
	}
	die();
}
?>

<style type='text/css'>
body{background-color:#ffffff;}
pre{font-size:10px;padding:10px;margin:0px;font-family:Verdana;}
.item{padding:10px;font-family:Verdana;font-size:10px;float:none;clear:both;}
.item .title {font-size:14px;color:#000000;font-weight:bold;font-family:Arial;}
.item .title b{}
.item em{display:block;font-size:10px;color:#888888;font-weight:bold;font-style:normal;}
.item span.body{padding:5px 20px;display:block;}
.item span.body blockquote{display:none;}
.item span.body a{color:#000066;}
.item a.author{display:block;background-color:#f0f0f0;padding:5px 20px;color:#000066;}
</style>
<pre>
<?=$stream->title?><br/>
<?=$stream->url?><br/>
<?=$stream->author?><br/>
</pre>

<?php foreach ((array)$stream->data as $item):?>
<div class='item'>
	<span class='title'><b><?=$item->id?></b> <?=$item->title?></span>
	<em><?=strftime("%d.%m.%Y %H:%M:%S",$item->date)?>, <?=date("r",$item->edited_date)?></em>
	<?php if (isset($item->file_list[0])):?>
		<img src='<?=$item->file_list[0]->GetUrl()?>' width='200' height='130' align='left'/>
	<?php endif?>
	<span class='body'><?=$item->GetBody()?></span>
	<span class='tag_list'>Ярлыки: <?=join(", ",$item->tag_list)?></span>
	<a class='author' href='<?=$item->url?>'><?=$item->author?></a>
</div>
<?php endforeach?>